<template>
    <h1>登录显示</h1>
    <div v-if="userStore.UserInfor.id">
        
        <table class="table table-bordered">
            <tr>
                <td>Id</td>
                <td>名字</td>
                <td>手机号</td>
                <td>用户名</td>
                <td>密码</td>
                <td>角色</td>
                <td>创造者</td>
            </tr>
            <tr v-for="item in list">
                <td>{{ item.id }}</td>
                <td>{{ item.name }}</td>
                <td>{{ item.phone.substring(0, 3) + "****" + item.phone.substring(7)}}</td>
                <td>{{ item.userName }}</td>
                <td>{{ item.pwd }}</td>
                <td>{{ item.colse }}</td>
                <td>{{ item.createName }}</td>
            </tr>
        </table>
    </div>
    <div v-else>
        请先登录<input value="登录" type="button" @click="login" />
    
    </div>
</template>

<script setup lang="ts">
import { reactive, toRefs, onMounted } from 'vue';
import { useRouter, useRoute } from 'vue-router';
import axios from 'axios';
import { useUserStore } from '@/stores/user';
let userStore = useUserStore();
let router = useRouter();
let route = useRoute();
let data: any = reactive({
    use: {

    },
    list: [],
});
let { use, list } = toRefs(data);

onMounted(() => {
    Show();
})
const Show = () => {
    let obj = {

    }
    axios({
        url: '/api/UserInfor/ListUsers',
        method: 'get',
        params: obj
    }).then((res) => {
        console.log(res);
        list.value = res.data.data
    })

}

const login = () => {
    router.push('/')
}
</script>

<style scoped></style>